#include "uMain.h"
#include "Sch51.h"
#include "debug.h"
#include "PD_UFP.h"
#include "charger.h"
#include "analog.h"
#include "osDispatcher.h"
#include "pdMonitorService.h"
#include "qcMonitorService.h"
#include "mahCaclService.h"
#include "uiService.h"
#include "infiniteAlgorithm.h"

uint8_t pdMonitor = 0;
uint8_t qcMonitor = 0;
uint8_t ui = 0;
uint8_t iAlgorithm = 0;
uint8_t mahCacl = 0;
void uMain(void)
{
	osDispatcherInit();
	sPdMonitorInit();
	sQCMonitorInit();
	sUIServiceInit();
	chargerInit();
	analogInit();
	
	ui = SCH_Add_Task(sUILoop, 0, UI_SERVICE_DURATION);
	pdMonitor = SCH_Add_Task(sPDMonitorLoop, 0, PD_MONITOR_SERVICE_DURATION);
	qcMonitor = SCH_Add_Task(sQCMonitorLoop, 0, QC_MONITOR_SERVICE_DURATION);
	iAlgorithm = SCH_Add_Task(infiniteAlgorithmLoop, 0, INFINITE_ALGORITHM_DURATION);
	mahCacl = SCH_Add_Task(smAHCacl,0,1000);//1S一次
	while (1)
	{
		SCH_Dispatch_Tasks();
	}
}
